<?php 

namespace app\controller\bossManager;


use app\service\UrlDomainRelationService;
use app\service\UrlDomainService;
use app\validate\UrlDomainValidate;


class UrlDomainController extends WebBossController{

    public function initValidate(){
        $this->validate = new UrlDomainValidate();
    }

    public function list_action(){
        $data = UrlDomainRelationService::getRelationByDomain();
        return self::ok($data);         
    }

    public function set_action(){  
        $input = $this->check();
        $res = UrlDomainService::edit($input); 
        return self::ok($res);
    }

    public function set_default_action(){  
        $input = $this->check();
        $res = UrlDomainService::setDefaultById($input['id']); 
        return self::ok($res);
    }

 
    public function del_action(){ 
        $input = $this->check();
        $res = UrlDomainService::delById($input['id']); 
        return self::ok($res);
    }

    public function type_all_list_action(){
        $input = $this->check();
        $data = UrlDomainService::getNativeAll(['type' => $input['type']],null,['is_default','priority DESC']);
        return self::ok($data); 
    }
}